home *** CD-ROM | disk | FTP | other *** search
- class Interface extends State
- {
- var bTimePaused;
- var sState;
- var mcRef;
- static var sSTATE_IDLE = "Idle";
- static var sSTATE_SHOW = "ShowScreen";
- function Interface(_mcRef)
- {
- super(_mcRef);
- CTRLGame.getRef().modifyTime(LD.getSongsMax(CTRLGame.getRef().Level));
- this.bTimePaused = false;
- this.setState(Interface.sSTATE_IDLE);
- }
- function doShow()
- {
- if(this.sState == Interface.sSTATE_IDLE)
- {
- this.setState(Interface.sSTATE_SHOW);
- CTRLGame.getRef().modifyTime(LD.getSongsMax(CTRLGame.getRef().Level));
- this.mcRef.btnMenu.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
- this.mcRef.btnMenu.onRelease = Delegate.create(Main.getRef(),Main.getRef().clickMenuButton);
- this.setScoreValue(CTRLGame.getRef().Score);
- }
- }
- function doHide()
- {
- if(this.sState != Interface.sSTATE_IDLE)
- {
- this.setState(Interface.sSTATE_IDLE);
- }
- }
- function setScoreValue(_nScore)
- {
- if(this.sState == Interface.sSTATE_SHOW)
- {
- this.mcRef.txtScore.text = Utils.styleNumber(_nScore);
- }
- }
- function doPause()
- {
- }
- function doUnPause()
- {
- }
- function pauseTime()
- {
- this.bTimePaused = true;
- }
- function unPauseTime()
- {
- this.bTimePaused = false;
- }
- function setToLife(_nValue)
- {
- CTRLGame.getRef().modifyTime(CTRLGame.getRef().Songs + _nValue);
- if(CTRLGame.getRef().Songs < 0)
- {
- CTRLGame.getRef().modifyTime(0);
- }
- else if(CTRLGame.getRef().Songs > LD.getSongsMax(CTRLGame.getRef().Level))
- {
- CTRLGame.getRef().modifyTime(LD.getSongsMax(CTRLGame.getRef().Level));
- }
- }
- function Idle()
- {
- }
- function ShowScreen()
- {
- if(!Controller.getRef().isPaused() && !this.bTimePaused)
- {
- if(CTRLGame.getRef().Songs > 0)
- {
- CTRLGame.getRef().modifyTime(CTRLGame.getRef().Songs - 1);
- }
- else
- {
- Main.getRef().loseGame();
- }
- }
- var _loc2_ = this.mcRef.mcSongs._totalframes - Math.round(CTRLGame.getRef().Songs / LD.getSongsMax(CTRLGame.getRef().Level) * 100);
- if(_loc2_ <= 0)
- {
- _loc2_ = 1;
- }
- this.mcRef.mcSongs.gotoAndStop(_loc2_);
- }
- }
-